package com.cloud.template.luna.entity;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

/**
 * 用户
 * Created by Viole on 2017/12/14.
 */
public class User implements Serializable {

    private long id;

    private long optimstic;

    private String userName;

    private String passWord;

    private String realName;

    private String phoneNum;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getOptimstic() {
        return optimstic;
    }

    public void setOptimstic(long optimstic) {
        this.optimstic = optimstic;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("optimstic", optimstic)
                .append("userName", userName)
                .append("passWord", passWord)
                .append("realName", realName)
                .append("phoneNum", phoneNum)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        return new EqualsBuilder()
                .append(id, user.id)
                .append(optimstic, user.optimstic)
                .append(userName, user.userName)
                .append(passWord, user.passWord)
                .append(realName, user.realName)
                .append(phoneNum, user.phoneNum)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(optimstic)
                .append(userName)
                .append(passWord)
                .append(realName)
                .append(phoneNum)
                .toHashCode();
    }
}
